package com.my.hp_hr.contorller.liuhao_controller;

import com.my.hp_hr.entity.liuhao_entity.Employee;
import com.my.hp_hr.service.liuhao_service.EmployeeService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/detail.do")
public class EmployeeDetailServlet extends HttpServlet {
    public EmployeeService employeeService=new EmployeeService();
    public Employee employee=new Employee();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        try {
            //登录员工的对象
            Employee employee_isLogin = (Employee) req.getSession().getAttribute("employee_isLogin");
            employee=employeeService.selectemployeedetail(employee_isLogin.getId());
            req.setAttribute("employee",employee);
            req.getRequestDispatcher("oneself_detail.jsp").forward(req,resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
